package com.codegzy.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Configuration
public class GlobalExceptionHandler implements HandlerExceptionResolver {

    //全局异常处理
    //参数1: 当前请求对象
    //参数2: 当前请求的响应对象
    //参数3: 当前出现异常的控制器对象
    @Override
    public ModelAndView resolveException(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) {
        return new ModelAndView("500");
    }
}
